package com.bins.knife4j.controller;

import com.bins.knife4j.dto.UserDto;
import com.bins.knife4j.service.UserService;
import com.bins.knife4j.vo.UserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Andybin
 */

@Api("用户服务")
@RestController
@RequestMapping("/userApi")
public class UserController {

    @Autowired
    private UserService userService;

    @ApiOperation("查询用户列表")
    @PostMapping("/findUserList")
    public List<UserVo> findUserList() {
        return userService.findUserList();
    }

    @ApiOperation("保存用户")
    @PostMapping("saveUser")
    public Boolean saveUser(@RequestBody UserDto dto) {
        return userService.saveUser(dto);
    }
}
